﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using KeRui.Common;

public partial class Manage_System_System : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ManageHelper.CheckAdminLogin();
        ManageHelper.CheckAdminPower("system_configsystem");
        if (ManageHelper.PageAct() == "save")
            ConfigSave();
    }

    private void ConfigSave()
    {
        ManageHelper.CheckAdminPower("system_configsystemupdate");
        KeRui.BLL.SysConfig bll = new KeRui.BLL.SysConfig();
        KeRui.Model.SysConfig model = new KeRui.Model.SysConfig();

        model = bll.GetModel("WebConfig", "WebsiteName");
        model.Value = PageRequest.GetString("WebsiteName");
        bll.Update(model);
        DataCache.RemoveCache("SysConfigValue-WebConfig-WebsiteName");

        model = bll.GetModel("WebConfig", "WebsiteUrl");
        model.Value = PageRequest.GetString("WebsiteUrl");
        bll.Update(model);
        DataCache.RemoveCache("SysConfigValue-WebConfig-WebsiteUrl");

        model = bll.GetModel("WebConfig", "PageHeadTitle");
        model.Value = PageRequest.GetString("PageHeadTitle");
        bll.Update(model);
        DataCache.RemoveCache("SysConfigValue-WebConfig-PageHeadTitle");

        model = bll.GetModel("WebConfig", "PageHeadMetaKeywords");
        model.Value = PageRequest.GetString("PageHeadMetaKeywords");
        bll.Update(model);
        DataCache.RemoveCache("SysConfigValue-WebConfig-PageHeadMetaKeywords");


        model = bll.GetModel("WebConfig", "PageHeadMetaDescription");
        model.Value = PageRequest.GetString("PageHeadMetaDescription");
        bll.Update(model);
        ManageHelper.AddLog("system_configsystemupdate","修改了系统配置");
        DataCache.RemoveCache("SysConfigValue-WebConfig-PageHeadMetaDescription");


        Response.Redirect("system.aspx?sucmsg=系统设置修改成功！");

    }
}
